<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>物流添加</title>
    <link href="../../lib/layui-v2.6.3/css/layui.css" media="all" rel="stylesheet">
    <link href="../../css/public.css" media="all" rel="stylesheet">
    <link href="../../css/diy/form1.css" rel="stylesheet">
    <script src="../../lib/layui-v2.6.3/layui.js"></script>
    <script src="../../lib/jquery-3.4.1/jquery-3.4.1.min.js"></script>
    <script src="../../js/lay-module/layuimini/miniTab.js"></script>
    <script src="../../frontstatic/js/notify.js"></script>
    <script src="../../frontstatic/js/notify_stand.js"></script>
    <style type="text/css">
        body{
            background-color: #FFFFFF;
        }
    </style>
</head>
<body>
<form class="layui-form" style="margin-left: -30px">
    <div class="layui-form-item"style="width: 500px">
        <label class="layui-form-label">公司名称:</label>
        <div class="layui-input-inline">
            <input autocomplete="off" class="layui-input" id="BrandName" lay-verify="required" placeholder="请输入" required type="text">
        </div>
    </div>
    <div class="layui-form-item" >
        <label class="layui-form-label">客服电话:</label>
        <div class="layui-input-inline">
            <input autocomplete="off" class="layui-input" id="phone" lay-verify="required" placeholder="请输入" required type="text">
        </div>
    </div>
    <div class="layui-form-item">
        <div class="layui-input-block" style="margin-top: 140px;margin-left: 480px">
            <button class="layui-btn layui-btn-normal" id="addBrandBtn" type="button">确定</button>
        </div>
    </div>
</form>
</body>
<script>
    var notify;
    layui.use(['notify'],function(){
        notify=layui.notify;
    })
    layui.use('form', function () {
        $("#addBrandBtn").on('click', function () {
            var val = $("#BrandName").val();
            var phone = $("#phone").val();
            if (val == "") {
                notify.warning("输入不能为空")
            } else {
                var log={
                    "name":val,
                    "phone":phone
                }
                $.ajax({
                    type : "POST",
                    contentType: "application/json; charset=utf-8",
                    data: JSON.stringify(log),
                    dataType: "json",
                    url:"/Logistics/save",
                    async : true,
                    success : function(date){
                        if (date.code==0) {
                            notify.success(date.msg)
                            var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
                            parent.layer.close(index);
                        }else {
                            notify.error(date.msg)
                        }
                    }
                })
            }
        })
    })

</script>
</html>